package com.massa.caronafacil.fragments;

import com.massa.caronafacil.R;
import com.massa.caronafacil.TabsViewPagerApplication;
import com.massa.caronafacil.activities.BuscarCaronasActivity;
import com.massa.caronafacil.activities.MinhasCaronasActivity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;

public class CaronasTabFragment extends Fragment implements OnClickListener {

	private Button minhasCaronasbutton;
	private Button buscarCaronasbutton;
	
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.tab_caronas_layout, null);

        minhasCaronasbutton = (Button) v.findViewById(R.id.buttonMinhasCaronas);
        minhasCaronasbutton.setOnClickListener(this);
        buscarCaronasbutton = (Button) v.findViewById(R.id.buttonBuscarCaronas);
        buscarCaronasbutton.setOnClickListener(this);
        
        return v;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onResume() {
        super.onResume();
    }
    
    @Override
    public void onClick(View v)
    {
        if (v != null) {
            switch (v.getId()) {
            case R.id.buttonMinhasCaronas:
                final Intent intentMinhasCaronas = new Intent(TabsViewPagerApplication.getAppContext(),
                        MinhasCaronasActivity.class);
                startActivity(intentMinhasCaronas);
                break;

            case R.id.buttonBuscarCaronas:
                final Intent intentBuscarCaronas = new Intent(TabsViewPagerApplication.getAppContext(),
                        BuscarCaronasActivity.class);
                startActivity(intentBuscarCaronas);
                break;
            }
        }
    }

}
